#ifndef MOUSEDIALOG_H
#define MOUSEDIALOG_H

#include <QDialog>
#include <QMouseEvent>

QT_BEGIN_NAMESPACE
namespace Ui {
class MouseDialog;
}
QT_END_NAMESPACE

class MouseDialog : public QDialog
{
    Q_OBJECT

public:
    MouseDialog(QWidget *parent = nullptr);
    ~MouseDialog();
private:
    // 按下
    void mousePressEvent(QMouseEvent *event);
    // 抬起
    void mouseReleaseEvent(QMouseEvent *event);
    // 移动
    void mouseMoveEvent(QMouseEvent *event);
private:
    Ui::MouseDialog *ui;
    bool m_drag;
    QPoint m_pos;       // 保存鼠标和label的相对位置
    // QRect(x, y, w, h) = QPoint(x, y) + QSize(w, h)
};
#endif // MOUSEDIALOG_H
